Skip to contentSkip to conversation

Change in openvpn[master]: iservice: return correct size when domains are truncated

Openvpn-devel In review d12fk (Code Review) 2 participants 9 messages Nov 23, 2025 – Nov 26, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1763880426000.Iabad046c930dd0f38ec50d1c43d8b3288816df7d@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email

to review the following change.

Change subject: iservice: return correct size when domains are truncated
......................................................................

iservice: return correct size when domains are truncated

In case not all domains can be converted in the available buffer, return the size of the already converted domains size plus the second terminating zero for the MULTI_SZ.

Change-Id Iabad046c930dd0f38ec50d1c43d8b3288816df7d

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/91/1391/1

src/openvpnserv/interactive.c +1 -1
index 37752b2..f31a8a9 100644
@@ -2214,7 +2214,7 @@
                 {
                     /* Domain doesn't fit, bad luck if it's the first one */
                     *pos = '\0';
-                    *size = converted_size == 0 ? 0 : *size + 1;
+                    *size = converted_size == 0 ? 0 : converted_size + 1;
                     return ERROR_MORE_DATA;
                 }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d
Gerrit-Change-Number: 1391
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos.

cron2 has posted comments on this change by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email )

Change subject: iservice: return correct size when domains are truncated
......................................................................

Patch Set 1: Code-Review-1

(2 comments)

Patchset:

PS1:
I might not understand this, but we have + one_glyph in one return branch, and + 1 in the other. This can't be both correct.

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/1391/comment/028ab026_9b0f67b5?usp=email :
PS1, Line 2217: *size = converted_size == 0 ? 0 : converted_size + 1;
+1 or + one_glyph?

The code 10 lines up does

```
                        /* This was the last domain */
                        *pos = '\0';
                        *size += one_glyph;
                        return wcslen(domains) ? NO_ERROR : ERROR_FILE_NOT_FOUND;
```

both can not be correct at the same time.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d
Gerrit-Change-Number: 1391
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Sun, 23 Nov 2025 11:57:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, plaisthos.

d12fk has posted comments on this change by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email )

Change subject: iservice: return correct size when domains are truncated
......................................................................

Patch Set 2:

(1 comment)

File src/openvpnserv/interactive.c:

http://gerrit.openvpn.net/c/openvpn/+/1391/comment/bf8a5953_96e69ead?usp=email :
PS1, Line 2217: *size = converted_size == 0 ? 0 : converted_size + 1;

Quoted 1 line

+1 or + one_glyph? […]

The longer I stare at the code, the less I like one_glyph as a name, will change it to glyph_size to make more sense. Patch on top follows.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d
Gerrit-Change-Number: 1391
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Sun, 23 Nov 2025 19:55:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, plaisthos.

Hello cron2, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email

to look at the new patch set (#3).

The following approvals got outdated and were removed:
Code-Review-1 by cron2

Change subject: iservice: return correct size when domains are truncated
......................................................................

iservice: return correct size when domains are truncated

In case not all domains can be converted in the available buffer, return the size of the already converted domains size plus the second terminating zero for the MULTI_SZ.

Change-Id Iabad046c930dd0f38ec50d1c43d8b3288816df7d

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/91/1391/3

src/openvpnserv/interactive.c +1 -1
index 9c533c1..5fb7f2b 100644
@@ -2214,7 +2214,7 @@
                 {
                     /* Domain doesn't fit, bad luck if it's the first one */
                     *pos = '\0';
-                    *size = converted_size == 0 ? 0 : *size + 1;
+                    *size = converted_size == 0 ? 0 : converted_size + one_glyph;
                     return ERROR_MORE_DATA;
                 }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d
Gerrit-Change-Number: 1391
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos.

cron2 has posted comments on this change by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email )

Change subject: iservice: return correct size when domains are truncated
......................................................................

Patch Set 3: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d
Gerrit-Change-Number: 1391
Gerrit-PatchSet: 3
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Wed, 26 Nov 2025 10:43:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#6 lore raw

PATCH v3 1/1 iservice: return correct size when domains are truncated

In reply to a message not in the archive

From: Heiko Hund <[email protected]...>

In case not all domains can be converted in the available buffer, return the size of the already converted domains size plus the second terminating zero for the MULTI_SZ.

Change-Id Iabad046c930dd0f38ec50d1c43d8b3288816df7d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1391
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1391
This mail reflects revision 3 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpnserv/interactive.c +1 -1
index 9c533c1..5fb7f2b 100644
@@ -2214,7 +2214,7 @@
                 {
                     /* Domain doesn't fit, bad luck if it's the first one */
                     *pos = '\0';
-                    *size = converted_size == 0 ? 0 : *size + 1;
+                    *size = converted_size == 0 ? 0 : converted_size + one_glyph;
                     return ERROR_MORE_DATA;
                 }
 
#7 lore raw

[Openvpn-devel] [PATCH applied] Re: iservice: return correct size when domains are truncated

This does what it says - return the correct overall size (either 0, or "what we have so far + extra 0 byte, counting the latter as wchar = glyph").

Your patch has been applied to the master branch.

commit aeda359efaeae3d2d77f7a89223fa1b5bcac2c90

Author: Heiko Hund
Date:   Wed Nov 26 11:43:07 2025 +0100
     iservice: return correct size when domains are truncated

     Signed-off-by: Heiko Hund <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1391
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34680.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#8 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#4) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: iservice: return correct size when domains are truncated
......................................................................

iservice: return correct size when domains are truncated

In case not all domains can be converted in the available buffer, return the size of the already converted domains size plus the second terminating zero for the MULTI_SZ.

Change-Id Iabad046c930dd0f38ec50d1c43d8b3288816df7d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1391
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34680.html

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/91/1391/4

src/openvpnserv/interactive.c +1 -1
index ed3c928..4a3e689 100644
@@ -2214,7 +2214,7 @@
                 {
                     /* Domain doesn't fit, bad luck if it's the first one */
                     *pos = '\0';
-                    *size = converted_size == 0 ? 0 : *size + 1;
+                    *size = converted_size == 0 ? 0 : converted_size + one_glyph;
                     return ERROR_MORE_DATA;
                 }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d
Gerrit-Change-Number: 1391
Gerrit-PatchSet: 4
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#9 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email )

Change subject: iservice: return correct size when domains are truncated
......................................................................

iservice: return correct size when domains are truncated

In case not all domains can be converted in the available buffer, return the size of the already converted domains size plus the second terminating zero for the MULTI_SZ.

Change-Id Iabad046c930dd0f38ec50d1c43d8b3288816df7d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1391
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34680.html

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpnserv/interactive.c +1 -1
index ed3c928..4a3e689 100644
@@ -2214,7 +2214,7 @@
                 {
                     /* Domain doesn't fit, bad luck if it's the first one */
                     *pos = '\0';
-                    *size = converted_size == 0 ? 0 : *size + 1;
+                    *size = converted_size == 0 ? 0 : converted_size + one_glyph;
                     return ERROR_MORE_DATA;
                 }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1391?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Iabad046c930dd0f38ec50d1c43d8b3288816df7d
Gerrit-Change-Number: 1391
Gerrit-PatchSet: 4
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>